﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <title>联想商城 - 购物车</title>
	
	<link href="{{asset('home/css/common.css')}}" type="text/css" rel="stylesheet">
    <link href="{{asset('home/css/buycart.css')}}" type="text/css" rel="stylesheet">
	<script src="{{asset('home/js/jquery-1.8.3.min.js')}}"></script>


    <link href="{{asset('home/css/headb.css')}}" type="text/css" rel="stylesheet">
    <style>
        .alert {position:fixed; border:3px solid #f60;  left:50%; top:40%; background:#fff; box-shadow:3px 3px 8px rgba(0,0,0,0.5); text-align:center; display:none;z-index:10000}
        .alert img,.alert span { vertical-align:middle;}
        .alert_body {padding:30px;}
    </style>
</head>
<body class="ns_body">
	
	<!--包含顶部文件-->
	@include('/home/cart/top');



    
<!-- ----------------===============     logo     ===============--------------- -->
<div class="top_logob">
    <img src="{{asset('home/images/pic-13.jpg')}}" class="top_logob_imga">
    <img src="{{asset('home/images/pic-12.jpg')}}" class="top_logob_imgb">
</div>


<div class="buycart w1200">
<div id="cart_main">

<div class="bc_table" id="main_table">


    <table cellpadding="0" cellspacing="0">
			<table class="table table-striped table-hover table-bordered" id="sample_editable_1">
		
				<thead>			
					<tr>
						<th width="100" >是否选中</th>
						<th width="300">商品名</th>
						<th width="163">规格</th>
						<th width="152">单价</th>
						<th width="152">数量</th>
						<th width="117">操作</th>
					</tr>
				</thead>
				<form action="/home/cart/settle" method="post" >
				<tbody>
					@if($shopcars->total())
					@foreach($shopcars as $shopcar)
					<tr class="active" gcode="53011" stock="673">
						<td width="57" class="bc_table_sel">
							<input type="checkbox" name="goods[]" class="goods"/>
						</td>
						<td width="148" class="bc_table_img">
							<a target="_blank"><img src="{{asset($shopcar['gpic'])}}" alt="" /></a>
						</td>
						<td width="257" class="bc_proname bc_name_gift">
							<a href="#" target="_blank" >{{$shopcar['gname']}}</a>
						</td>
						<td width="152" class="price1" style="position:relative;">
							{{$shopcar['price']}}
						</td>
						<td width="152">
							<input  type="number" value="{{$shopcar['number']}}" class="number" style="width:80px;height:30px;text-align:center;font-size:16px"/>
						</td>
						<td align="center">
							<!-- 按钮触发模态框 -->
							<button data-id="{{$shopcar['carid']}}" class="delete" >删除</button>
						</td>
					</tr>
					@endforeach
					@else
						<tr><td colspan="5">没有查询到相关信息</td></tr>
					@endif
				</tbody>
				</form>
		</table>
    </table>

</div>
<div class="bc_num clearfix">
    <div class="bc_num_fl">
        <a href="javascript:;" class="bc_num_del" ></a>
    </div>
    <ul class="bc_num_fr">
        <li style="margin-top:0;" >商品总价：<input readonly type="text" class="totalprice"> 元</li>
        
        <li>合计：<span class="bc_red" id="totalmoneyf">{{$shopcar['createtime']}}</span> 元</li>
    </ul>
</div>
<div class="bc_probtn "><button href="/home/cart/settle" type="submit" class="jiesuan">去结算</button></div>





</div>

<script type="text/javascript">
	$(function(){
		$('.delete').click(function(){
			//获取删除用户的id
			var carid=$(this).attr('data-id');

			//确定用户操作

			if(!confirm('你确定你要删除id为:'+carid+'的商品吗?')){
				return false;
			}
			var $btn=$(this);
			//ajax传送到服务器
			$.ajax({
				url:'/home/cart/delete',
				data:'carid='+carid,
				type:'get',
				dataType:'text',
				success:function(data){
					//根据返回信息判断是否删除成功
					if(data == 1){
						$btn.parents('tr').remove();
					}else{
						alert('删除失败');
					}
				}
			})

		});
		
		$(function(){
			var total=0;
			$('.goods').click(function(){
				var price = $(this).parent(".bc_table_sel").next().next().next().get(0).innerHTML;
				var num = $(this).parent(".bc_table_sel").next().next().next().next().children().val();
				total =parseInt(total) + parseInt(price*num);
				$('.totalprice').val(total)
			})
		})
		
	
	});
	
</script>




	<div id="foot_div">
    
<!--服务列表-->
<div class="ns_Services-list ns_fixClear" id="Services-list">
    <div class="ns_w">
    	<img width="1200" height="83" class="lazy_img" src="{{asset('home/images/cmbzefzz7i-adjipaabalgu8yuw364.jpg')}}">
        <ul>
            <li class="ns_services-1">官方品质保障 <em>the official quality guarantee</em></li>
            <li class="ns_services-2">1对1客户式服务<em>one-to-one customer</em></li>
            <li class="ns_services-3">个性化定制服务<em>personalized customer service</em></li>
            <li class="ns_services-4">全场免费速递<em>full free delivery</em></li>
            <li class="ns_services-5">无忧完美服务<em>perfect customer service</em></li>
            <li class="ns_services-6">精美专利包装<em>patent packaging</em></li>
            <li class="ns_services-7">新品抢先体验<em>new experience</em></li>
        </ul>
    </div>
</div>

<!--服务列表-->
<!--页脚-->
@include('/home/cart/footer');

</div>

	


	
	
</body>
</html>
